<template>
  <a-breadcrumb class="container-breadcrumb">
    <a-breadcrumb-item>
      <icon-apps v-if="isNameEmpty" />
      <svg-icon class="icon" v-else :name="name" />
    </a-breadcrumb-item>
    <a-breadcrumb-item v-for="item in items" :key="item">
      {{ item }}
    </a-breadcrumb-item>
  </a-breadcrumb>
</template>

<script lang="ts" setup>
  import { PropType, computed } from 'vue';
  import { isEmpty } from 'lodash';

  const props = defineProps({
    items: {
      type: Array as PropType<string[]>,
      default() {
        return [];
      },
    },
    name: {
      type: String,
      default() {
        return '';
      },
    },
  });

  const isNameEmpty = computed(() => {
    return isEmpty(props.name);
  });
</script>

<style scoped lang="less">
  .container-breadcrumb {
    margin: 16px 0;
    :deep(.arco-breadcrumb-item) {
      color: rgb(var(--gray-6));
      &:last-child {
        color: rgb(var(--gray-8));
      }
    }
  }
  .icon {
    width: 1.5em;
    height: 1.5em;
  }

  :deep(.arco-breadcrumb-item) {
    display: flex;
    align-items: center;
  }
</style>
